function selfUser() {
    getUserInfoAPI((res) => {
         if (res.status === 0) {
            let {
                id,
                username,
                nickname,
                email,
                user_pic
            } = res.data
            $('input[name=id]').val(id)
            $('input[name=username]').val(username)
            $('input[name=nickname]').val(nickname)
            $('input[name=email]').val(email)
        }
    })

}
selfUser()

// 确认修改

$('form').on('submit', function (e) {
    e.preventDefault()
    const data = $(this).serialize()
    updateUserInfoAPI(data,res => {
        layer.msg(res.message)
        if (res.status === 0) {
            window.parent.getUserInfo()
        }
    })
})


$('.my-reset').on('click', function () {
    selfUser()
})
layui.form.verify({
    nickname: [
        /^[\u4e00-\u9fa5]+$/,
        '昵称只能是中文'
    ]
})